import { Label, Sprite, SpriteFrame } from 'cc';
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('RankItem')
export class RankItem extends Component {
    @property({ type: Node, displayName: "未上榜" })
    noInRank: Node;
    
    @property({ type: Label, displayName: "排名" })
    rankLabel: Label;
    
    @property({ type: Sprite, displayName: "背景" })
    rankSp: Sprite;

    @property({ type: [SpriteFrame], displayName: "背景图片" })
    rankBgs: SpriteFrame[] = [];
    UpdateInfo(info){
        if(info <= 3){
            this.rankLabel.string = info
            this.rankLabel.node.active = true
            this.rankSp.spriteFrame = this.rankBgs[info - 1]
        }
        else{
            this.noInRank.active = true;
        }
    }
}


